| Class | SimplyPresentable::ActiveRecordPrototypePresenter |
| In: |
vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_prototype.rb
|
| Parent: | SimplyPresentable::ActiveRecordPresenter |
like replace_on except replaces the inner html rather than the outer html.
# File vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_prototype.rb, line 19
19: def replace_html_on(page, options = {})
20: local_options = options.dup
21: page.replace_html(local_options.delete(:dom_id) || @presenter_proxy.dom_id(local_options), @presenter_proxy.partial_options(local_options))
22: end
Will replace the element on the page corresponding to the presented object by rendering the partial as determined by PartialPresenter#partial_options:
render_update { |page| present(Foo.find(1)).replace_on(page) }
This renders the partial foos/show and replaces the element foo_1 on the page with the partial
Options:
| :dom_id: | An alternate dom_id to use for identification of the element to replace |
The options for PartialPresenter#partial_options can be used to control the rendering of the partial
# File vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_prototype.rb, line 13
13: def replace_on(page, options = {})
14: local_options = options.dup
15: page.replace(local_options.delete(:dom_id) || @presenter_proxy.dom_id(local_options), @presenter_proxy.partial_options(local_options))
16: end
Will perform a visual_effect on the element on the page corresponding to the presented object
render_update { |page| present(Foo.find(1)).visual_effect_on(page, :highlight) }
This will highlight the element with the id foo_1
Options:
| :dom_id: | An alternate dom_id to use for identification of the element perform the effect on |
# File vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_prototype.rb, line 30
30: def visual_effect_on(page, effect, options = {})
31: local_options = options.dup
32: page.visual_effect effect, local_options.delete(:dom_id) || @presenter_proxy.dom_id(local_options), local_options.delete_if { |k, v| k == :dom_prefix }
33: end